#include "easybutterfly.h"
#include <avr/io.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "PC_serial.h"



//VARIABLES
uint8_t state; 			// 0=init  1=transfer_data 2=reset_device 3=display_temp 4=set_intervall 5=pause 6=sleep_mode 7=menu
uint8_t leave_flag = 0;	// flag variable for confiramation of commands

uint16_t interval_min; 	// Measurement interval (default is 5 min)
uint8_t min, hrs;		// set_intervall variables

uint8_t counter_sec, counter_min, counter_hour, counter_day; 	//counters for time measurement
uint32_t compare_timer;

uint8_t sleep_counter; 	// variable to go into sleep_mode

uint16_t page;			// page number of lfash memory

char data[20],a[25];					//variable for memory usage

uint8_t menu_choose; 			//menu variable (run once)
uint8_t sleep_mode_counter; 	//variable for sleep_mode activation

uint8_t overwrite_flag;		//flag   1:memory full start overwriting values    0: memory not yet full
uint8_t pause_flag;			//is the temp storage paused? 0=NO  1=YES



//FUNCTIONS


void display_temp(void);  	//display temp

void store_data(void);		//stroring values into flash memory
void compare_time(void);

void set_interval(void);	//set measurement intervall

void transfer_data(void);	//transfer data via uart

void pause_continue(void);	//pause or continue measurement


void sleepmode(void);		//go into sleep mode
void LCD_disable(void);

void disable_interrupt(void); 	//One second interrupt
void init_interrupt(void);

int reset(void);			//reset whole programm
